package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.PersonnelService;
import com.yixun.qfbao.apidto.GetPartnerByPremisesReqDto;
import com.yixun.qfbao.apidto.GetPartnerByPremisesResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetPartnerByPremisesReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description 楼盘相关经纪人接口
 * @Date 2017/11/24
 * @Author sangtao
 * @Computer Administrator
 */
@Service("GetPartnerByPremisesHander")
public class GetPartnerByPremisesHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetPartnerByPremisesHander.class);
    @Autowired
    PersonnelService personnelService;
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetPartnerByPremisesReqVo req = (GetPartnerByPremisesReqVo)reqDto;
        GetPartnerByPremisesReqDto getPartnerByPremisesReqDto = req.getParams();
        BaseResponseDTO<GetPartnerByPremisesResDto> res = new BaseResponseDTO<GetPartnerByPremisesResDto>();
        GetPartnerByPremisesResDto resDto = new GetPartnerByPremisesResDto();
        try{
            resDto = personnelService.getPartnerByPremises(getPartnerByPremisesReqDto);
        } catch (Exception e) {
            logger.error("GetPartnerByPremisesHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg("楼盘相关经济人!");
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
